package example;

import org.example.domain.Goods;
import org.example.service.BuyService;
import org.example.service.StudentService;
import org.example.service.impl.BuyServiceImpl;
import org.example.service.impl.StudentServiceImpl;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.ArrayList;
import java.util.List;

public class MyTest03 {
    @Test
    public  void  test01(){
        List<Goods> arr=new ArrayList<>();
        Goods goods1=new Goods();
        goods1.setId(1);
        goods1.setAmount(50);
        arr.add(goods1);

        Goods goods2=new Goods();
        goods2.setId(2);
        goods2.setAmount(50);
        arr.add(goods2);

        Goods goods3=new Goods();
        goods3.setId(3);
        goods3.setAmount(50);
        arr.add(goods3);

        String config="applicationContext.xml";
        ApplicationContext ctx=new ClassPathXmlApplicationContext(config);
        BuyService  buyService= ctx.getBean(BuyServiceImpl.class);
        buyService.BuyGoods(arr);
    }
}
